<template>
  <div class="block">
    <el-pagination
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pageNum"
      :page-size="pageSize"
      layout="total, prev, pager, next, jumper"
      :total="countTotal"
    ></el-pagination>
  </div>
</template>

<script>
export default {
  props: {
    countTotal: Number,
  },
  data() {
    return {
      pageSize: 10,
      pageNum: 1,
    };
  },
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.pageNum = val;
      this.$emit("pageNum", val);
    },
  },
};
</script>

<style scoped>
.block {
    margin-top: 20px;
}
</style>